<div class="layui-container">
    <div class="layui-row">
        <div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
			<div class="widget-head">
				<div class="widget-title">网站设置</div></div>
			<form id="my-form" class="layui-form" action="{url:('setting/index')}" enctype="multipart/form-data" method="post">
				<div class="widget-body layui-col-lg12">
					<div class="layui-tab layui-tab-brief" lay-filter="test">
						<ul class="layui-tab-title">
							<li class="layui-this">基础设置</li>
							<li>交易设置</li>
							<li>短信通知</li>
							<li>模板消息</li>
							<li>上传设置</li>
						</ul>
						<div class="layui-tab-content">
							<div class="layui-tab-item layui-show">
								<div class="widget-head">
									<div class="widget-title ">商城设置</div></div>
								<div class="layui-form-item layui-col-md6">
									<label class="layui-form-label">网站备案号:</label>
									<div class="layui-input-block">
										<input type="text" class="layui-input" name="setting[store][record_no]" value="{$values['store']['values']['record_no'] ?? ''}">
									</div>
								</div>
								<div class="layui-form-item layui-col-md6">
									<label class="layui-form-label">网站名称:</label>
									<div class="layui-input-block ">
										<input type="text" class="layui-input" name="setting[store][name]" value="{$values['store']['values']['name'] ?? ''}"></div>
								</div>
								<div class="layui-form-item layui-col-md6">
									<label class="layui-form-label">网站标题:</label>
									<div class="layui-input-block ">
										<input type="text" class="layui-input" name="setting[store][store_title]" value="{$values['store']['values']['store_title'] ?? ''}"></div>
								</div>
								<div class="layui-form-item layui-col-md6">
									<label class="layui-form-label">网站描述:</label>
									<div class="layui-input-block ">
										<input type="text" class="layui-input" name="setting[store][store_desc]" value="{$values['store']['values']['store_desc'] ?? ''}"></div>
								</div>
								<div class="layui-form-item layui-col-md6">
									<label class="layui-form-label">联系人:</label>
									<div class="layui-input-block ">
										<input type="text" class="layui-input" name="setting[store][contact]" value="{$values['store']['values']['contact'] ?? ''}"></div>
								</div>
								<div class="layui-form-item layui-col-md6">
									<label class="layui-form-label">联系电话：</label>
									<div class="layui-input-block ">
										<input type="text" class="layui-input" name="setting[store][phone]" value="{$values['store']['values']['phone'] ?? ''}"></div>
								</div>
								<div class="layui-form-item layui-col-md6">
									<label class="layui-form-label">具体地址：</label>
									<div class="layui-input-block ">
										<input type="text" class="layui-input" name="setting[store][address]" value="{$values['store']['values']['address'] ?? ''}"></div>
								</div>
							</div>
							<div class="layui-tab-item">
								<div class="widget-head">
									<div class="widget-title ">订单流程设置</div></div>
								<div class="layui-form-item">
									<label class="layui-form-label">未支付订单</label>
									<div class="layui-input-block  ">
										<div class="layui-col-sm4">
											<input type="number" class="layui-input" name="setting[trade][order][close_days]" value="{$values['trade']['values']['order']['close_days'] ?? 0}" class="layui-input" pattern="^(0|\+?[1-9][0-9]*)$"></div>
										<div class="layui-form-mid layui-word-aux">天后自动关闭</div>
										<div class="help-block layui-col-sm12">
											<small>订单下单未付款，n天后自动关闭，设置0天不自动关闭</small></div>
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">已发货订单</label>
									<div class="layui-input-block  ">
										<div class="layui-col-sm4">
											<input type="number" class="layui-input" name="setting[trade][order][receive_days]" value="{$values['trade']['values']['order']['receive_days']  ?? 0}" pattern="^(0|\+?[1-9][0-9]*)$"></div>
										<div class="layui-form-mid layui-word-aux">天后自动确认收货</div>
										<div class="help-block layui-col-sm12">
											<small>如果在期间未确认收货，系统自动完成收货，设置0天不自动收货</small></div>
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">售后订单</label>
									<div class="layui-input-block  ">
										<div class="layui-col-sm4">
											<input type="number" class="layui-input" name="setting[trade][order][sale]" value="{$values['trade']['values']['order']['sale'] ?? 0}" pattern="^(0|\+?[1-9][0-9]*)$"></div>
										<div class="layui-form-mid layui-word-aux">天后自动进入分佣</div>
										<div class="layui-col-sm12">
											<small>订单未申请售后,n天后将禁止再次申请,直接进入分佣</small></div>
									</div>
								</div>
								<div class="widget-head">
									<div class="widget-title">运费设置</div></div>
								<div class="layui-form-item">
									<div class="layui-form-item">
										<label class="layui-form-label">组合策略</label>
										<div class="layui-input-block">
											<input type="radio" name="setting[trade][freight_rule]" value="10" {notempty name="$values[ 'trade'][ 'values'][ 'freight_rule']"}{$values[ 'trade'][ 'values'][ 'freight_rule']==='10' ? 'checked' : ''}{/notempty}>运费叠加</div>
										<div class="layui-input-block">
											<small>订单中的商品有多个运费模板时，将每个商品的运费之和订为订单总运费</small></div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label"></label>
										<div class="layui-input-block">
											<input type="radio" name="setting[trade][freight_rule]" value="20" {notempty name="$values[ 'trade'][ 'values'][ 'freight_rule']"}{$values[ 'trade'][ 'values'][ 'freight_rule']==='20' ? 'checked' : ''}{/notempty}>以最低运费结算</div>
										<div class="layui-input-block">
											<small>订单中的商品有多个运费模板时，取订单中运费最少的商品的运费计为订单总运费</small></div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label"></label>
										<div class="layui-input-block">
											<input type="radio" name="setting[trade][freight_rule]" value="30" {notempty name="$values[ 'trade'][ 'values'][ 'freight_rule']"}{$values[ 'trade'][ 'values'][ 'freight_rule']==='30' ? 'checked' : ''}{/notempty}>以最高运费结算</div>
										<div class="layui-input-block">
											<small>订单中的商品有多个运费模板时，取订单中运费最多的商品的运费计为订单总运费</small></div>
									</div>
								</div>
							</div>
							<div class="layui-tab-item">
								<div class="widget-head">
									<div class="widget-title ">短信通知（阿里云短信）</div></div>
								<input type="hidden" name="setting[sms][default]" value="aliyun">
								<div class="layui-form-item  layui-col-md6">
									<label class="layui-form-label">AccessKeyId</label>
									<div class="layui-input-block ">
										<input type="text" class="layui-input" name="setting[sms][engine][aliyun][AccessKeyId]" value="{$values['sms']['values']['engine']['aliyun']['AccessKeyId'] ?? ''}"></div>
								</div>
								<div class="layui-form-item  layui-col-md6">
									<label class="layui-form-label">AccessKeySecret</label>
									<div class="layui-input-block ">
										<input type="text" class="layui-input" name="setting[sms][engine][aliyun][AccessKeySecret]" value="{$values['sms']['values']['engine']['aliyun']['AccessKeySecret'] ?? ''}"></div>
								</div>
								<div class="layui-form-item  layui-col-md6">
									<label class="layui-form-label">短信签名</label>
									<div class="layui-input-block ">
										<input type="text" class="layui-input" name="setting[sms][engine][aliyun][sign]" value="{$values['sms']['values']['engine']['aliyun']['sign'] ?? ''}"></div>
								</div>
								<div class="widget-head  layui-col-md12">
									<div class="widget-title ">新付款订单提醒</div></div>
								<div class="layui-form-item">
									<label class="layui-form-label">是否开启短信提醒</label>
									<div class="layui-input-block ">
										<label class="layui-inline">
											<input type="radio" name="setting[sms][engine][aliyun][order_pay][is_enable]" value="1" {notempty name="$values['sms']['values']['engine']['aliyun']['order_pay']['is_enable']"}{$values['sms']['values']['engine']['aliyun']['order_pay']['is_enable']==='1' ? 'checked' : '' }{/notempty}>开启</label>
										<label class="layui-inline">
											<input type="radio" name="setting[sms][engine][aliyun][order_pay][is_enable]" value="2" {notempty name="$values['sms']['values']['engine']['aliyun']['order_pay']['is_enable']"}{$values['sms']['values']['engine']['aliyun']['order_pay']['is_enable']==='2' ? 'checked' : '' }{/notempty}>关闭</label></div>
								</div>
								<div class="layui-form-item  layui-col-md6">
									<label class="layui-form-label">模板ID
										<span class="">Template Code</span></label>
									<div class="layui-input-block ">
										<input type="text" class="layui-input" name="setting[sms][engine][aliyun][order_pay][template_code]" value="{$values['sms']['values']['engine']['aliyun']['order_pay']['template_code'] ??''}">
										<small>例如：SMS_139800030</small></div>
								</div>
								<div class="layui-form-item">
									<div class="layui-input-block layui-col-smpush-3">
										<small>模板内容：您有一条新订单，订单号为：123456789 ，请注意查看。</small></div>
								</div>
								<div class="layui-form-item  layui-col-md6">
									<label class="layui-form-label">接收手机号</label>
									<div class="layui-input-block ">
										<input type="text" class="layui-input" name="setting[sms][engine][aliyun][order_pay][accept_phone]" value="{$values['sms']['values']['engine']['aliyun']['order_pay']['accept_phone']??''}">
										<div class="help-block">
											<small>接收测试:
												<a class="j-sendTestMsg" data-msg-type="order_pay" href="javascript:void(0);">点击发送</a></small>
										</div>
									</div>
								</div>
							</div>
							<div class="layui-tab-item">
								<div class="widget-head">
									<div class="widget-title ">支付成功通知</div></div>
								<div class="layui-form-item ">
									<label class="layui-form-label">是否启用</label>
									<div class="layui-input-block">
										<label class="layui-inline">
											<input type="radio" name="setting[tplMsg][payment][is_enable]" value="1" {notempty name="$values['tplMsg']['values']['payment']['is_enable']"}{$values['tplMsg']['values']['payment']['is_enable']==='1' ? 'checked' : ''}{/notempty}>开启</label>
										<label class="layui-inline">
											<input type="radio" name="setting[tplMsg][payment][is_enable]" value="2" {notempty name="$values['tplMsg']['values']['payment']['is_enable']"}{$values['tplMsg']['values']['payment']['is_enable']==='2' ? 'checked' : ''}{/notempty}>关闭</label>
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">模板消息ID
										<span class="tpl-form-line-small-title">Template ID</span></label>
									<div class="layui-input-block">
										<input type="text" class="layui-input" name="setting[tplMsg][payment][template_id])" value="{$values['tplMsg']['values']['payment']['template_id']??''}">
										<div class="help-block layer-margin-top-xs">
											<small>模板编号AT0009，关键词 (订单编号、支付时间、订单金额、商品名称)</small>
										</div>
									</div>
								</div>
								<div class="widget-head">
									<div class="widget-title ">订单发货通知</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">是否启用</label>
									<div class="layui-input-block">
										<label class="layui-inline ">
											<input type="radio" name="setting[tplMsg][delivery][is_enable]" value="1" {notempty name="$values[ 'tplMsg'][ 'values'][ 'delivery'][ 'is_enable']"}{$values[ 'tplMsg'][ 'values'][ 'delivery'][ 'is_enable']==='1' ? 'checked' : ''}{/notempty} >开启</label>
										<label class="layui-inline ">
											<input type="radio" name="setting[tplMsg][delivery][is_enable]" value="2" {notempty name="$values[ 'tplMsg'][ 'values'][ 'delivery'][ 'is_enable']"}{$values[ 'tplMsg'][ 'values'][ 'delivery'][ 'is_enable']==='2' ? 'checked' : ''} {/notempty}>关闭</label></div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">模板消息ID
										<span class="tpl-form-line-small-title">Template ID</span></label>
									<div class="layui-input-block">
										<input type="text" class="layui-input" name="setting[tplMsg][delivery][template_id]" value="{$values['tplMsg']['values']['delivery']['template_id']??''}">
										<small>模板编号AT0007，关键词 (订单编号、商品信息、收货人、收货地址、物流公司、物流单号)</small></div>
								</div>
							</div>
							<div class="layui-tab-item">
								<div class="widget-head">
									<div class="widget-title ">文件上传设置</div></div>
								<div class="layui-form-item">
									<label class="layui-form-label">默认上传方式</label>
									<div class="layui-input-block ">
										<label class="layui-inline">
											<input type="radio" name="setting[storage][default]" value="local" {notempty name="$values[ 'storage'][ 'values'][ 'default']"}{$values[ 'storage'][ 'values'][ 'default']==='local' ? 'checked' : '' }{/notempty}>本地 (不推荐)</label>
										<label class="layui-inline">
											<input type="radio" name="setting[storage][default]" value="qiniu" {notempty name="$values[ 'storage'][ 'values'][ 'default']"}{$values[ 'storage'][ 'values'][ 'default']==='qiniu' ? 'checked' : '' }{/notempty}>七牛云存储</label>
										<label class="layui-inline">
											<input type="radio" name="setting[storage][default]" value="aliyun" {notempty name="$values[ 'storage'][ 'values'][ 'default']"}{$values[ 'storage'][ 'values'][ 'default']==='aliyun' ? 'checked' : ''}{/notempty}>阿里云OSS</label>
										<label class="layui-inline">
											<input type="radio" name="setting[storage][default]" value="qcloud" {notempty name="$values[ 'storage'][ 'values'][ 'default']"}{$values[ 'storage'][ 'values'][ 'default']==='qcloud' ? 'checked' : ''}{/notempty}>腾讯云COS</label></div>
								</div>
								<div id="qiniu" class="form-tab-group {!empty($values['storage']['values']['default']) ? 'qiniu' : 'active' }">
									<div class="layui-form-item">
										<label class="layui-form-label">存储空间名称
											<span class="tpl-form-line-small-title">Bucket</span></label>
										<div class="layui-input-block ">
											<input type="text" class="layui-input" name="setting[storage][engine][qiniu][bucket]" value="{$values['storage']['values']['engine']['qiniu']['bucket']??''}"></div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">ACCESS_KEY
											<span class="tpl-form-line-small-title">AK</span></label>
										<div class="layui-input-block ">
											<input type="text" class="layui-input" name="setting[storage][engine][qiniu][access_key]" value="{$values['storage']['values']['engine']['qiniu']['access_key']??''}"></div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">SECRET_KEY
											<span class="tpl-form-line-small-title">SK</span></label>
										<div class="layui-input-block ">
											<input type="text" class="layui-input" name="setting[storage][engine][qiniu][secret_key]" value="{$values['storage']['values']['engine']['qiniu']['secret_key']??''}"></div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">空间域名
											<span class="tpl-form-line-small-title">Domain</span></label>
										<div class="layui-input-block ">
											<input type="text" class="layui-input" name="setting[storage][engine][qiniu][domain]" value="{$values['storage']['values']['engine']['qiniu']['domain']??''}">
											<small>请补全http:// 或 https://，例如：http://static.cloud.com</small></div>
									</div>
								</div>
								<div id="aliyun" class="form-tab-group {!empty($values['storage']['values']['default']) ? 'aliyun' : 'active'}">
									<div class="layui-form-item">
										<label class="layui-form-label">存储空间名称
											<span class="tpl-form-line-small-title">Bucket</span></label>
										<div class="layui-input-block ">
											<input type="text" class="layui-input" name="setting[storage][engine][aliyun][bucket]" value="{$values['storage']['values']['engine']['aliyun']['bucket']??''}"></div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">AccessKeyId</label>
										<div class="layui-input-block ">
											<input type="text" class="layui-input" name="setting[storage][engine][aliyun][access_key_id]" value="{$values['storage']['values']['engine']['aliyun']['access_key_id']??''}"></div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">AccessKeySecret</label>
										<div class="layui-input-block ">
											<input type="text" class="layui-input" name="setting[storage][engine][aliyun][access_key_secret]" value="{$values['storage']['values']['engine']['aliyun']['access_key_secret']??''}"></div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">空间域名
											<span class="tpl-form-line-small-title">Domain</span></label>
										<div class="layui-input-block ">
											<input type="text" class="layui-input" name="setting[storage][engine][aliyun][domain]" value="{$values['storage']['values']['engine']['aliyun']['domain']??''}">
											<small>请补全http:// 或 https://，例如：http://static.cloud.com</small></div>
									</div>
								</div>
								<div id="qcloud" class="form-tab-group {!empty($values['storage']['values']['default'] ? 'qcloud' : 'active'}">
									<div class="layui-form-item">
										<label class="layui-form-label">存储空间名称
											<span class="tpl-form-line-small-title">Bucket</span></label>
										<div class="layui-input-block ">
											<input type="text" class="layui-input" name="setting[storage][engine][qcloud][bucket]" value="{$values['storage']['values']['engine']['qcloud']['bucket']??''}"></div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">所属地域
											<span class="tpl-form-line-small-title">Region</span></label>
										<div class="layui-input-block ">
											<input type="text" class="layui-input" name="setting[storage][engine][qcloud][region]" value="{$values['storage']['values']['engine']['qcloud']['region']??''}">
											<small>请填写地域简称，例如：ap-beijing、ap-hongkong、eu-frankfurt</small></div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">SecretId</label>
										<div class="layui-input-block ">
											<input type="text" class="layui-input" name="setting[storage][engine][qcloud][secret_id]" value="{$values['storage']['values']['engine']['qcloud']['secret_id']??''}"></div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">SecretKey</label>
										<div class="layui-input-block ">
											<input type="text" class="layui-input" name="setting[storage][engine][qcloud][secret_key]" value="{$values['storage']['values']['engine']['qcloud']['secret_key']??''}"></div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">空间域名
											<span class="tpl-form-line-small-title">Domain</span></label>
										<div class="layui-input-block ">
											<input type="text" class="layui-input" name="setting[storage][engine][qcloud][domain]" value="{$values['storage']['values']['engine']['qcloud']['domain']??''}">
											<small>请补全http:// 或 https://，例如：http://static.cloud.com</small></div>
									</div>
								</div>
							</div>

						<div class="layui-form-item">
						<button type="submit" class="j-submit layui-btn ">提交</button>
						</div>
					</div>
					
				</div>
		</div>
		</form>
    </div>
</div>
</div>
<!-- 图片文件列表模板 -->
<!-- 文件库弹窗 -->{include file="layouts/_template/file_library" /}
<script>$(function() {

        // 切换默认上传方式
        $("input:radio[name='setting[storage][default]']").click(function(e) {
            $('.form-tab-group').removeClass('active');
            switch (e.currentTarget.value) {
            case 'qiniu':
                $('#qiniu').addClass('active');
                break;
            case 'qcloud':
                $('#qcloud').addClass('active');
                break;
            case 'aliyun':
                $('#aliyun').addClass('active');
                break;
            case 'local':
                break;
            }
        });

    });

    $(function() {
        //地址的定位
        layui.use('element',
        function() {
            var $ = layui.jquery,
            element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
        });

        /**
         * 表单验证提交
         * @type {*}
         */
        $('#my-form').superForm();

    });</script>